Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 3 - Writing Scripting Additions / Types of Scripting Additions


Apple Event Handler Scripting Addition

The 'osax' resource for an Apple event handler follows the following convention:
Resource type 'osax'
Resource IDAn identifier (for example, 6991)
Resource name'AEVTclssidid'

The letters AEVT in the resource name indicate that the scripting addition uses the event handler interface. The next eight characters represent the event's class and ID.

The 'osax' code resource for a scripting addition handler is in the form of
an Apple event handler. The entry point for the code resource must follow the Apple event handler function interface as follows:

In C,

pascal OSErr MyAEHandlerFunction (AppleEvent theEvent,  
                                   AppleEvent theReply,
                                   long theRefCon);
In Pascal,

FUNCTION MyAEHandlerFunction 
                        (theEvent, theReply: AppleEvent; 
                         theRefCon: Longint): OSErr;
The scripting addition handler is an extension to the AppleScript language. It needs an 'aete' resource that describes the human-language terms defined by the scripting addition for use in scripts, such as the names of commands, objects, and properties. The high word of the resource ID for the 'aete' is a script code that indicates the script system (that is, writing system) for which the 'aete' is written, and the low word is a language code that indicates the human language for which the 'aete' is written. For example, the resource ID of the 'aete' resource of the sample scripting addition shown in Listing 3-3 is 0; thus both the high word and low word are also 0, indicating that the resource is intended for use with the Roman script system and English terminology.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996